home *** CD-ROM | disk | FTP | other *** search
/ Interactive Web Graphics with Shout 3D / Interactive Web Graphics With Shout 3D.iso / pc / Shout3Ddemo / Shout3d_runtime / demos / javascript_createFromStringTest < prev    next >
Text File  |  2000-10-12  |  5KB  |  48 lines

  1. <html>
  2. <head>
  3. <SCRIPT language="JavaScript">
  4. function loadScene1(){
  5.     document.Shout3D.setScene( document.Shout3D.createNodeFromString("Transform { children Shape { appearance Appearance { material Material {} } geometry Sphere {}}}"));
  6. }
  7. function loadScene2(){
  8.     document.Shout3D.setScene( document.Shout3D.createNodeFromString("Transform { children Shape { appearance Appearance { material Material {} } geometry Box {}}}"));
  9. }
  10. function loadScene3(){
  11.     document.Shout3D.setScene( document.Shout3D.createNodeFromString(
  12. "Transform { " +
  13. "    children [    DEF ROTATE_XF Transform { " +
  14. "       children    Shape { " +
  15. "        appearance    Appearance {       material    Material {            diffuseColor .8 .8 .8       }        }" +
  16. "        geometry    DEF _0 IndexedFaceSet { " +
  17. "       coord    Coordinate { " +
  18. "        point    [ -1 6 1,    -1 -6 1,    1 6 1,    1 -6 1,    1 6 -1, 1 -6 -1,    -1 6 -1,    -1 -6 -1,          -11 6 1,              -11 -6 1,              -9 -6 1,              -9 6 1,              -9 -6 -1,              -9 6 -1,              -11 6 -1,              -11 -6 -1,              10 6 1,              10 -6 1,              12 -6 1,              12 6 1,              12 -6 -1,              12 6 -1,              10 6 -1,              10 -6 -1,              -1 8 1,              -1 6 1,              1 6 1,              1 8 1,              1 6 -1,              1 8 -1,              -1 8 -1,              -1 6 -1,              -11 8 1,              -11 6 1,              -9 6 1,              -9 8 1,              -9 6 -1,              -9 8 -1,              -11 8 -1,              -11 6 -1,              10 8 1,              10 6 1,              12 6 1,              12 8 1,              12 6 -1," +
  19. "              12 8 -1,     10 8 -1, 10 6 -1,      -1 -6 1,              -1 -8 1,              1 -8 1,              1 -6 1,              1 -8 -1,              1 -6 -1,              -1 -6 -1,              -1 -8 -1,              -11 -6 1,              -11 -8 1,              -9 -8 1,              -9 -6 1,              -9 -8 -1,              -9 -6 -1,              -11 -6 -1,              -11 -8 -1,              10 -6 1,              10 -8 1,              12 -8 1,              12 -6 1,              12 -8 -1,              12 -6 -1,              10 -6 -1,              10 -8 -1,              -9 1 1,              -9 -1 1,              -1 -1 1,              -1 1 1,              -1 -1 -1,              -1 1 -1,              -9 1 -1,              -9 -1 -1,              -9 8 1,              -9 6 1,              -1 6 1,              -1 8 1,              -1 6 -1,              -1 8 -1,              -9 8 -1,              -9 6 -1,              -9 -6 1,              -9 -8 1,              -1 -8 1," +              
  20. "    -1 -6 1, -1 -8 -1,          -1 -6 -1,              -9 -6 -1,              -9 -8 -1,              1 -6 1,              1 -8 1,              10 -8 1,              10 -6 1,              10 -8 -1,              10 -6 -1,              1 -6 -1,              1 -8 -1,              1 8 1,              1 6 1,              10 6 1,              10 8 1,              1 6 -1,              10 6 -1,              10 8 -1,              1 8 -1,              1 1 1,              1 -1 1,              10 -1 1,              10 1 1,              1 -1 -1,              10 -1 -1,              10 1 -1,              1 1 -1 ]" +
  21. "       }" +
  22. "       coordIndex    [ 0, 1, 3, 2, -1, 4, 5, 7,           6, -1, 6, 7, 1, 0, -1, 2,           3, 5, 4, -1, 8, 9, 10, 11,           -1, 11, 10, 12, 13, -1, 13, 12,           15, 14, -1, 14, 15, 9, 8, -1,           16, 17, 18, 19, -1, 19, 18, 20,           21, -1, 21, 20, 23, 22, -1, 22,           23, 17, 16, -1, 24, 25, 26, 27,           -1, 27, 26, 28, 29, -1, 30, 24,           27, 29, -1, 29, 28, 31, 30, -1," +           " 30, 31, 25, 24, -1, 32, 33, 34, 35, -1, 35, 34, 36, 37, -1, 38,           32, 35, 37, -1, 37, 36, 39, 38,           -1, 38, 39, 33, 32, -1, 40, 41,           42, 43, -1, 43, 42, 44, 45, -1,           46, 40, 43, 45, -1, 45, 44, 47,           46, -1, 46, 47, 41, 40, -1, 48,           49, 50, 51, -1, 51, 50, 52, 53,           -1, 53, 52, 55, 54, -1, 49, 55,           52, 50, -1, 54, 55, 49, 48, -1,           56, 57, 58, 59, -1, 59, 58, 60,           61, -1, 61, 60, 63, 62, -1, 57," +           " 63, 60, 58, -1, 62, 63, 57, 56, -1, 64, 65, 66, 67, -1, 67, 66,           68, 69, -1, 69, 68, 71, 70, -1,           65, 71, 68, 66, -1, 70, 71, 65,           64, -1, 72, 73, 74, 75, -1, 75,           74, 76, 77, -1, 78, 72, 75, 77,           -1, 77, 76, 79, 78, -1, 73, 79,           76, 74, -1, 78, 79, 73, 72, -1,           80, 81, 82, 83, -1, 83, 82, 84,           85, -1, 86, 80, 83, 85, -1, 85,           84, 87, 86, -1, 81, 87, 84, 82,           -1, 86, 87, 81, 80, -1, 88, 89,           90, 91, -1, 91, 90, 92, 93, -1,           94, 88, 91, 93, -1, 93, 92, 95,           94, -1, 89, 95, 92, 90, -1, 94,           95, 89, 88, -1, 96, 97, 98, 99,           -1, 99, 98, 100, 101, -1, 102, 96,           99, 101, -1, 101, 100, 103, 102, -1,           97, 103, 100, 98, -1, 102, 103, 97,           96, -1, 104, 105, 106, 107, -1, 105,           108, 109, 106, -1, 107, 106, 109, 110,           -1, 111, 104, 107, 110, -1, 111, 108,           105, 104, -1, 110, 109, 108, 111, -1," +
  23. "           112, 113, 114, 115, -1, 113, 116, 117,           114, -1, 115, 114, 117, 118, -1, 119,           112, 115, 118, -1, 119, 116, 113, 112,           -1, 118, 117, 116, 119, -1 ]" +       
  24. "        } }  translation    0 0 0 }," +
  25. "    DEF TIMER TimeSensor {   cycleInterval    8   loop    TRUE    }," +
  26. "    DEF ROTATE_INTERP OrientationInterpolator {   key    [ 0, 0.25, 0.5, 0.75,       1 ]   keyValue    [ 0 0 1  0,       0 -1 0  1.57079,       0 -1 0  3.14,       0 -1 0  4.71,       0 0 1  0 ]    }    ]    " +
  27. " } Viewpoint {  position    26.1692 -2.09626 -25.7654  orientation    -0.00372968 0.999953 0.00898283  2.35454  fieldOfView    0.785398" +
  28. " } ROUTE ROTATE_INTERP.value_changed TO ROTATE_XF.set_rotation ROUTE TIMER.fraction_changed TO ROTATE_INTERP.set_fraction"
  29.  ) );
  30. }
  31.  
  32. </SCRIPT>
  33. </head>
  34.  
  35. <body>
  36. <applet MAYSCRIPT ALIGN=LEFT VALIGN=MIDDLE NAME="Shout3D" CODEBASE="../codebase" CODE="applets/ExamineApplet.class" ARCHIVE="shout3dClasses.zip" WIDTH="300" HEIGHT="400">
  37.   <param name="src" value="models/chooseTwoTextures.wrl">
  38.   <param name="backgroundColorR" value="0">
  39.   <param name="backgroundColorG" value="0">
  40.   <param name="backgroundColorB" value="0">
  41.   <param name="headlightOn" value="true">
  42. </applet>
  43. <A HREF="javascript: loadScene1()">Click to read and load sphere from string</A><BR>
  44. <A HREF="javascript: loadScene2()">Click to read and load box from string</A><BR>
  45. <A HREF="javascript: loadScene3()">Click to read and load rotating window from string</A><BR>
  46. </body>
  47. </html>
  48.